$def with (page)
$ stats = stats_summary()
$ raw_time = stats.get('total', {}).get('time') # Assumes that if total present, it's a dict
$if raw_time is not None:
  $ total_time = float(raw_time) * 1000
$else:
  $ total_time = 0

<script type="text/javascript">
if (window.archive_analytics) {
  var vs = window.archive_analytics.get_data_packets();
  for (var i in vs) {
    vs[i]['cache_bust']=Math.random();
    vs[i]['server_ms']=$total_time;
    vs[i]['server_name']='ol-web.us.archive.org';
    vs[i]['service']='ol';
      }
  if(window.flights){
    window.flights.init();
  }
  if ($$(".more_search").size()>0) {
    window.archive_analytics.send_scroll_fetch_base_event();
  }
  window.q.push(function(){
    \$(document).on('click', '[data-ol-link-track]', function(event) {
      var category_action = \$(this).attr('data-ol-link-track').split('|');
      window.archive_analytics.ol_send_event_ping({'category': category_action[0], 'action': category_action[1]});
    });
  });
}
</script>
